package SwingView.Quiz;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import JDBC.StudentQuizActivities;
import SwingController.CmsPresenter;
import SwingModel.CmsQuiz;
import SwingModel.CmsQuizSubmission;

public class ALQuizViewResult implements ActionListener{

	private CmsQuiz quiz;
	private CmsQuizSubmission quizSub;
	private String username;
	private int quizID;
	
	public ALQuizViewResult(CmsQuiz quiz, CmsQuizSubmission quizSub){
		this.quiz = quiz;
		this.quizSub = quizSub;
		this.quizID = quiz.getQuizID();
		this.username = quizSub.getStudentID();
	}
	
	public ALQuizViewResult(int quizID, String username){
		this.quizID = quizID;
		this.username = username;
	}
	
	@Override
	public void actionPerformed(ActionEvent e) {
		CmsPresenter.mainView.displayQuizResultPage( StudentQuizActivities.retrieveQuiz(CmsPresenter.user.getSelectedCourse().getCourseID(), quizID)
											, StudentQuizActivities.getQuizSubmission(quizID, username));
	}

}
